package com.example.dao;

import com.example.domain.Book;
import com.example.domain.Book;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BookDao {

    @Insert("insert into book values(null,#{type},#{name},#{description})")
    public int save(Book book);

    @Update("update book set type=#{type},name=#{name},description=#{description} where id=#{id}")
    public int update(Book book);

    @Delete("delete from book where id=#{id}")
    public int delete(Integer id);

    @Select("select *from book where id=#{id}")
    public Book getById(Integer id);

    @Select("select *from book")
    public List<Book> getAll();
}
